package day02;

import utils.JDBCUtils;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class JDBCUtilsTest {
    public static void main(String[] args) {
        Connection root = JDBCUtils.getConnection();
        Statement sta;
        ResultSet rs;
        try {
            sta = root.createStatement();
            rs = sta.executeQuery("select * from emp");
            while (rs.next()){
                int id = rs.getInt(1);
                String name = rs.getString(2);
                String loc = rs.getString(3);
                System.out.println(id + " : " + name + " : " + loc);
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
        JDBCUtils.close(root,sta,rs);
    }
}